<template>
  <div class="sub-menu"
    @mouseenter="mouseEnter"
    @mouseleave="mouseLeave"
  >
    <div class="title">
      <slot name="title"></slot>
      <span class="coin">&gt;</span>
    </div>
    <div 
      class="sub"
      v-show="isShow">
      <slot name="sub"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SubMenu',
  data() {
    return {
        isShow:false
      }
  },
  methods: {
    mouseEnter() {
      this.isShow = true;
    },
    mouseLeave() {
      this.isShow = false;
    }
  }
}
</script>

<style lang="scss">
.sub-menu {
    position: relative;
    width: 100%;
    height: 44px;
    line-height: 44px;
    text-align: center;

    .title {
      position: relative;

      .coin {
        position: absolute;
        top: 0;
        right: 10px;
      }
    }

    .sub {
      position: absolute;
      top: 0;
      left: 100%;
      width: 100%;
      background-color: #999;
      color: #fff;
    }
}
</style>
